package thread;

public class ThreadDemo8 {
    public static void main(String[] args) {
        Thread t = new Thread(() ->{
            try {
                //该线程的运行时间大概是1s
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        System.out.println("start之前哦: "+t.isAlive());
        t.start();
        System.out.println("start之后哦: "+t.isAlive());
        try {
            //2s之后线程已经结束
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("t结束之后 :"+t.isAlive());
        //线程执行完之后再start也是报错,和线程的状态转换有关
//        t.start();
    }
}
